//
//  ZhuanTiGunDongCellCollectionViewCell.m
//  礼物说
//
//  Created by dllo on 16/4/22.
//  Copyright © 2016年 sunzhichao. All rights reserved.
//

#import "ZhuanTiGunDongCellCollectionViewCell.h"

@interface ZhuanTiGunDongCellCollectionViewCell ()

@property (nonatomic, retain) BaseImageView *imgView;

@end

@implementation ZhuanTiGunDongCellCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)dealloc {
    [_model release];
    [_imgView release];
    [super dealloc];
}

- (void)setModel:(ZhuanTiModels *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.image_url] placeholderImage:[UIImage imageNamed:@"placeholder@2x副本.png"]];
}

- (void)createCell {
    self.imgView = [[BaseImageView alloc] init];
    [self.contentView addSubview:_imgView];
    [_imgView release];
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super layoutSubviews];
    _imgView.frame = self.contentView.frame;
    _imgView.layer.cornerRadius = 10;
    _imgView.layer.masksToBounds = YES;
}

@end
